package com.txy.dao.impl;

import com.itany.jdbc.core.JdbcTemplate;
import com.txy.dao.UserDao;
import com.txy.entity.User;
import com.txy.mapper.UserMapper;

/**
 * Author：汤小洋
 * Date：2022-11-08 14:00
 * Description：<描述>
 */
public class UserDaoImpl implements UserDao {

    JdbcTemplate<User> jt = new JdbcTemplate<>();

    @Override
    public User selectByUsernameAndPassword(String username, String password) {
        String sql = new StringBuffer()
                .append(" select ")
                .append("   id,username,password,name,age,status ")
                .append(" from  ")
                .append("   t_user ")
                .append(" where ")
                .append("   username=? and password=? and status=1 ")
                .toString();
        return jt.queryForObject(sql,new UserMapper(),username,password);
    }
}
